<--- %%NOBANNER%% --> SysChk.sas
 BackForward

/*-------------------<-- Start of Description-->---------------------\
| Check User's Operating System, and assign a new library reference  |
| to the system temporary directory: c:\windows\temp\ for Windows 98 |
| and Windows 95, and c:\winnt\temp\ for Window NT system;           |
|---------------------<-- End of Description-->----------------------|
|--------------------------------------------------------------------|
|-----------<-- Start of Files or Arguements Needed-->---------------|
| Arguments:                                                         |
|    libref - the name of the library reference you want to assign;  |
|    tempdir - the name of the directory of which you want to save   |
|              the system temporary directory;                       |
|    Note: if you want to use the macro directory, you will have to  |
|          make the tempdir as a global variable;                    |
|------------<-- End of Files or Arguements Needed-->----------------|
|--------------------------------------------------------------------|
|------------------<-- Start of Files Created-->---------------------|
| Example:                                                           |
|    1)  %global sysdir;                                             |
|        %SysChk(libref=systemin, tempdir=sysdir);                   |
|        %put sysdir is &sysdir and ;                                |
|        %put libref is %sysfunc(pathname(systemin));                |
| Usage: %chksys(libref=,tempdir=);                                  |
\------------------<-- Start of Files Created-->--------------------*/
%macro SysChk(libref=,tempdir=);
/*--------------------------------------------\
| Author:   Duo Zhou;                         |
| Created:  12-28-2001 8:10pm;                |
| Modified: 11-12-2001 9:14pm;                |
| Purpose:  Assign system temp directory;     |
\--------------------------------------------*/
%local systmpdir;
%if (%quote(%upcase(&SYSSCPL))=%quote(WIN_98)) or (%quote(%upcase(&SYSSCPL))=%quote(WIN_95)) %then %do;
   %if (%length(&libref)>0) %then %do;
      libname &libref "C:\windows\temp";
   %end;
   %if (%length(&tempdir)>0) %then %do;
      %let &tempdir=C:\windows\temp;
   %end;
   %let systmpdir=C:\windows\temp;
%end;
%else %do;
   %if (%length(&libref)>0) %then %do;
      libname &libref "C:\WINNT\Temp";
   %end;
   %if (%length(&tempdir)>0) %then %do;
      %let &tempdir=C:\WINNT\Temp;
   %end;
   %let systmpdir=C:\WINNT\Temp;
%end;
%put -->Note: you are using "&SYSSCPL" Operating system, your system temporary;
%put -->      directory is under "&systmpdir".;
%mend SysChk;